<?
    abstract class RepositoryController extends Controller
    {
		protected $entity;
		
		protected function repo()
        {
            return new Repository($this->entity);
        }

        public function remove($id)
        {
            $rep = $this->repo();
            $rep->remove($id);

            return array('success' => true);
        }

        public function update($id, $row)
        {
            $rep = $this->repo();
            $rep->update($row, $id);

            return array('success' => true);
        }

        public function create($row)
        {
            $rep = $this->repo();
            $data = $rep->insert($row);

            return array(
                'success' => true,
                'data' => $data
            );
        }
    }
?>